package net.warl0ck.mjjp;
/*
 * MahJong Java Player
 * @author WarL0ck
 * @date 15.06.2009
 * @version 0.1
 */

import java.awt.*;
import javax.swing.*;
import net.warl0ck.mjjp.MJTypes.*;

public class MahJongPlayer extends JApplet {
	private static final long serialVersionUID = 1L;
	private MJFile file;
	private MJParams params;
	private String locale;

	public void init() {
		GreateGUI();
	}

	private void GreateGUI(){
		setLayout(new BorderLayout());
		params  = new MJParams(); 
		params.loadParams(this);
		if (params.testParams()){
			setLoc(params.getLoc());
			MJLoader loader = new MJLoader(params.getUrl());
			file = loader.parseFile(params);
			MJTable table = new MJTable(file,params);
			MJPlayer plr = new MJPlayer(file,getLoc(),table);
			add(table,BorderLayout.CENTER);
			add(plr,BorderLayout.SOUTH);
		}
	}

	public void setLoc(String locale) {
		this.locale = locale;
	}

	public String getLoc() {
		return locale;
	}
}
